package com.gujiangbo.gc;

import org.apache.commons.lang3.RandomUtils;

/**
 * @Author: gujiangbo.co
 * @Contact: 646832012@qq.com
 * @Date: 2022/3/13 17:56
 * @Version: 1.0
 * @Description: 1
 * -Xms10m -Xmx10m -XX:+PrintGCDetails -XX:+PrintCommandLineFlags -XX:+UseSerialGC    (DefNew + Tenured)
 * 2
 * -Xms10m -Xmx10m -XX:+PrintGCDetails -XX:+PrintCommandLineFlags -XX:+UseParNewGC    (DefNew + Tenured)
 * 3
 * -Xms10m -Xmx10m -XX:+PrintGCDetails -XX:+PrintCommandLineFlags -XX:+UseParallelGC   (PSYoungGen + ParOldGen)
 * 4
 * 4.1
 * -Xms10m -Xmx10m -XX:+PrintGCDetails -XX:+PrintCommandLineFlags -XX:+UseParallelOldGC   (PSYoungGen + ParOldGen)
 * 4.2 不加就是默认useParallelGC
 * -Xms10m -Xmx10m -XX:+PrintGCDetails -XX:+PrintCommandLineFlags                        (PSYoungGen + ParOldGen)
 */
public class JavaGc {

    public static void main(String[] args) {
        StringBuilder msg = new StringBuilder("hello");

        while (true) {
            msg.append(msg.toString()).append(RandomUtils.nextInt(1, 9999999)).append(RandomUtils.nextInt(2, 9999999));
        }
    }
}
